package com.audi.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class Preference {
	private SharedPreferences shareData;
	private String KEY_DATA_ID_PLACE = "key_data_id_place";
	private String KEY_DATA_LIST_DEVICE = "key_data_list_device";
	private String KEY_BOX_PASSWORD = "key_box_password";
	private String KEY_PLACE_NAME = "key_place_name";
	private String KEY_BOX_NAME = "key_box_name";
	private String KEY_MY_MEMBER_NAME = "key_my_member_name";

	public String getKEY_PLACE_NAME() {
		return shareData.getString(KEY_PLACE_NAME, null);
	}

	public void setKEY_PLACE_NAME(String placename) {
		Editor editor = shareData.edit();
		editor.putString(KEY_PLACE_NAME, placename);
		editor.commit();
	}

	public Preference(Context context) {
		shareData = context.getSharedPreferences("share", 0);

	}

	/*
	 * set Idplace
	 */
	public void setIdplaceData(int idplaceInfo) {
		Editor editor = shareData.edit();
		editor.putInt(KEY_DATA_ID_PLACE, idplaceInfo);
		editor.commit();
	}

	/*
	 * set ListDevice
	 */
	public void setListDeviceData(String listDeviceInfo) {
		Editor editor = shareData.edit();
		editor.putString(KEY_DATA_LIST_DEVICE, listDeviceInfo);
		editor.commit();
	}

	/*
	 * get PlaceId
	 */
	public int getIdplaceData() {
		return shareData.getInt(KEY_DATA_ID_PLACE, 0);
	}

	/*
	 * getListDevice
	 */
	public String getListDeviceData() {
		return shareData.getString(KEY_DATA_LIST_DEVICE, null);
	}

	public String getBoxPassword() {
		return shareData.getString(KEY_BOX_PASSWORD, null);
	}

	public void setBoxPassword(String boxPassword) {
		Editor editor = shareData.edit();
		editor.putString(KEY_BOX_PASSWORD, boxPassword);
		editor.commit();
	}

	public String getBoxName() {
		return shareData.getString(KEY_BOX_NAME, null);
	}

	public void setBoxName(String boxName) {
		Editor editor = shareData.edit();
		editor.putString(KEY_BOX_NAME, boxName);
		editor.commit();
	}

	public String getMyMember() {
		return shareData.getString(KEY_MY_MEMBER_NAME, null);
	}

	public void setMyMember(String myMember) {
		Editor editor = shareData.edit();
		editor.putString(KEY_MY_MEMBER_NAME, myMember);
		editor.commit();
	}
}
